package com.example.demo.threadDemo.thtradPools;

import java.util.concurrent.Callable;

/**
 * @Description MyCallable
 * @Author songchuanlong
 * @Date 2025-05-12
 */
public class MyCallable implements Callable<String> {
    private int n;
    public MyCallable(int n){
        this.n=n;
    }
    @Override
    public String call() throws Exception {
        int sum = 0;
        for(int i=0;i<=n;i++){
            sum+=i;
        }
        return Thread.currentThread().getName()+"线程求出了1-”+n+“的和是："+sum;
    }
}
